{include file="Public:header2"/}
<body style="min-height: 100%;background-color: #fff">
<div style="padding: 0 20px;position: relative;z-index: 99;border-bottom: 1px solid #e5e5e5;line-height: 39px;height: 39px;overflow: hidden;">
      <span style="visibility: visible;">
        <a href="{:url('/admin/uploadsFile')}" style="padding-right: 8px;line-height: 22px;font-size: 14px;color: #333!important;">系统设置<span class="layui-box">&gt;</span></a>
        <a href="javascript:;"> <cite>上传设置</cite></a>
      </span>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form onsubmit="return false;">
                        <div class="layui-form" wid100 lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">上传设置</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="type" value="1" {if condition="$data['type'] eq 1"} checked{/if} lay-verify="required" title="本地存储" class="layui-input" lay-filter="ChoiceRadio">
                                    <input type="radio" name="type" value="2" {if condition="$data['type'] eq 2"} checked{/if} lay-verify="required" title="阿里云存储" class="layui-input" lay-filter="ChoiceRadio">
                                </div>
                            </div>
                            <div class="layui-form-item xuan" {if condition="$data['type'] eq 1"} style="display:none;" {/if}>
                                <label class="layui-form-label">空间名称 Bucket</label>
                                <div class="layui-input-block">
                                    <input type="text" name="Bucket" value="{$data['Bucket']}" lay-verify="required" title="空间名称Bucket" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item xuan" {if condition="$data['type'] eq 1"} style="display:none;" {/if}>
                                <label class="layui-form-label">AccessKeyId</label>
                                <div class="layui-input-block">
                                    <input type="text" name="AccessKeyId" value="{$data['AccessKeyId']}" lay-verify="required" title="AccessKeyId" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item xuan" {if condition="$data['type'] eq 1"} style="display:none;" {/if}>
                                <label class="layui-form-label">AccessKeySecret</label>
                                <div class="layui-input-block">
                                    <input type="text" name="AccessKeySecret" value="{$data['AccessKeySecret']}" lay-verify="required" title="AccessKeySecret" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item xuan" {if condition="$data['type'] eq 1"} style="display:none;" {/if}>
                                <label class="layui-form-label">空间域名 Domain</label>
                                <div class="layui-input-block">
                                    <input type="text" name="url" value="{$data['url']}" lay-verify="required" title="空间域名 Domain" class="layui-input">
                                </div>
                            </div>
                            <input type="hidden" name="key" value="{$key}">
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" onclick="return check()">确认保存</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
</body>
</html>
<script type="text/javascript">
    layui.use(['layer','form','upload','element'], function(){
        var $ = layui.$;
        var form = layui.form;
        //获取单选框选中的值
        form.on('radio(ChoiceRadio)', function(data){
            if(data.value==2){
                $('.xuan').css("display",'block');
            }else{
                $('.xuan').css("display",'none');
            }
        });
    });

    function check(){
        var url="{:url('/admin/update')}";
        var $ = layui.$;
        var load=layer.load(2);
        $.post(url,$("form").serialize(),function(data){
            if(data.status==1){
                layer.msg(data.msg,{icon:1,time:1000},function(){
                    location.reload();
                });
            }else{
                layer.msg(data.msg,{icon:2,anim:6,time:1500},function(){
                    layer.close(load);
                });
            }
        })
    }
</script>